home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / 386p_200.zip / 386SYS.INC < prev    next >
Text File  |  1994-10-26  |  4KB  |  96 lines

  1. ;-----------------------------------------------------------------------------
  2. ; VGA status port
  3.  
  4. STATUS          = 03DAh ; status register port
  5.  
  6. IS_HVSYNC       = 01
  7. IS_VSYNC        = 08
  8.  
  9. ;-----------------------------------------------------------------------------
  10. ; Programmable Interrupt Timer  (PIT) chip 8253
  11.  
  12. ;PIT data ports
  13. PIT0 = 40h ; channel 0, its output is connected to the IRQ0 input
  14. PIT1 = 41h ; channel 1, do nor use this, on AT was used to refresh dram
  15. PIT2 = 42h ; channel 2, can be connected to the pc-speaker 
  16. ;PIT control port
  17. PIT_CTRL = 43h 
  18.  
  19. ; COMMAND WORDS (actually bytes)
  20. ;
  21. ; bit         7     6           5       4        3   2   1       0
  22. ; value    counter_select    read_write_latch   counter_mode    bcd_on
  23.  
  24. T_SET0 = 036h ; channel 0, square wave, READ/WRITE COUNT INTERVAL
  25.               ; LSB then MSB on data port
  26.               ; this is the standard way to reprogram the IRQ frequency
  27.               ; or to read the programmed time count value
  28.               
  29.               
  30. T_LATCH0 = 000h ; channel 0, LATCH counter (read current count value)
  31.                 ; then  if the timer channel was programmed with two bytes
  32.                 ;               first LSB, then MSB
  33.                 ;       else
  34.                 ;               read byte
  35.                 ;       end if
  36.                 ; this is the standard way to "read on the flight"
  37.                 ; what's the current counter value (NOT the count interval)
  38.  
  39.               
  40. T_SET2 = 0B6h ; channel 2, square wave, read/write LSB then MSB on data port
  41.               ; use this to make the pc speaker buzz
  42.               ; but remember to connect the channel 2 output to speaker output
  43.               
  44. ;------------------------------------------------------------------------------
  45. ; Programmable Interrupt Controllers                  
  46.  
  47. ; Master PIC: IRQ0..IRQ7 ( IRQ2 chains slave PIC)
  48. PIC0_CTRL = 020h
  49. PIC0_DATA = 021h
  50. ; PIC0_DATA is a irq control mask for irqs 0..7
  51. ; (if bit n is set to 1 the corresponding irq line is inhibited)
  52. ; BIT   IRQ   USAGE
  53. ;   0     0   timer interrupt
  54. ;   1     1   keyboard controller
  55. ;   2     2   cascade from slave PIC (PIC1) , on XT was the vretrace irq
  56. ;   3     3   com2 (usually free on single serial port systems)
  57. ;   4     4   com1
  58. ;   5     5   printer port 2 (was hard disk irq on XT systems) (usually free)
  59. ;   6     6   floppy disk
  60. ;   7     7   printer port 1 (usually free, most software uses polling)
  61. ;  N.B. most of the old cards (or new cards with old software drivers)
  62. ;       needs an irq ranging from 0 to 7 (because the upper irqs works
  63. ;       only with 16bit cards and the irq acknowledge sequence
  64. ;       is different for irq 8..15).
  65.  
  66. ; Slave PIC: IRQ8..IRQF ( IRQ9 is the "alias" for the original unchained IRQ2
  67. ; found on pc-xt , so if you set a board on IRQ2 it will use IRQ9)
  68. PIC1_CRTL = 0A0h
  69. PIC1_DATA = 0A1h
  70. ; PIC1_DATA is a irq control mask for irqs 8..15
  71. ; (if bit n is set to 1 the corresponding irq line is inhibited)
  72. ; BIT   IRQ   USAGE
  73. ;   0     8   realtime clock
  74. ;   1     9   redirected vertical retrace (was irq2 on old XT systems)
  75. ;   2    10   <free>
  76. ;   3    11   <free>
  77. ;   4    12   mouse irq ( used by non-serial-port mouses)
  78. ;   5    13   coprocessor exception
  79. ;   6    14   AT hard disk irq
  80. ;   7    15   <free>
  81. ;   N.B  <free> means available to other expansion boards
  82. ;        (i.e. sound boards, scanners or who-knows-what)
  83. ;
  84.  
  85. ; to "terminate" an IRQ request on the PIC you must send to
  86. ; the control ports ....
  87. EOI  = 020h ; End Of Interrupt (activates the next irq pending on another line)
  88. SEOI = 060h ; Specific End Of Interrupt (use this to avoid overruns)
  89.             ; if there are overruns send 
  90.             ; (SEOI+(IRQ_number mod 8)) instead of a plain EOI
  91.             
  92. ; to terminate an irq request on PIC1 you must FIRST
  93. ; send an EOI to PIC0 (because PIC1 chains PIC0 using IRQ2)
  94. ; and then terminate the irq on PIC1
  95.  
  96.